function includes(collection,ch){
  for(let item of collection){
    if(item===ch){
      return true;
    }
  }
}

function collectSameElements(collectionA, objectB) {
  let result=[];
  let collectionB=objectB.value;
  for(let item of collectionA){
    if(includes(collectionB,item)){
      result.push(item);
    }
  }
  console.log(result);
  return result;
}
module.exports = collectSameElements;
collectSameElements(['a', 'e', 'h', 't', 'f', 'c', 'g', 'b', 'd'],{value: ['a', 'd', 'e', 'f']});